package com.demo.actionbar;

import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.example.myalldemo.R;

public class MainActionBarActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.actionbar_main);
		Button showBt = (Button) findViewById(R.id.showBt);
		showBt.setOnClickListener(new OnClickListener() {
			public void onClick(View view) {
				ActionBar actionBar = getActionBar();
				actionBar.show(); // Call requires API level 11: android.app.ActionBar#show
			}
		});

	}

	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		MenuItem add = menu.add(0, 1, 0, "Save");
		MenuItem open = menu.add(0, 2, 1, "Open");
		MenuItem close = menu.add(0, 3, 2, "Close");
		add.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
		open.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
		close.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
		return true;
	}
}
